#ifndef __UNIXNETWORK_H__
# define __UNIXNETWORK_H__

typedef	int		handle;

# include <arpa/inet.h>
# include <netdb.h>
# include <sys/socket.h>
# include <sys/time.h>
# include <sys/types.h>
# include <unistd.h>

# include "INetwork.h"

class			unixNetwork : public INetwork
{
public:
	unixNetwork(int domain, int type, int protocol, const char *ip, int port, int backlog);
	unixNetwork(const unixNetwork &);
	~unixNetwork(void);
	unixNetwork	&operator=(const unixNetwork &);
	bool		createSocket(void);
	bool		closeSocket(handle socket = -1);
	bool		bindNetwork(void);
	bool		listenNetwork(void);
	bool		acceptNetwork(handle *);
	bool		selectNetwork(int*, int, fd_set*, fd_set*, fd_set*, struct timeval*);
	bool		initialize(void);

private:
	handle		_socket;
	int			_domain;
	int			_type;
	int			_protocol;
	const char	*_ip;
	int			_port;
	int			_backlog;
};

#endif // __UNIXNETWORK_H__
